#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
inline int read(){
    char c;
    int x=0,f=1;
    c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-'){
            f=-1;
        }
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=x*10+c-'0';
        c=getchar();
    }
    return x*f;
}
void write(int x){
    char c[100];
    int l=0;
    if(x<0){
            putchar('-');
            x=-x;
    }
    while(x>0){
        c[l++]=x%10+'0';
        x/=10;
    }
    while(l--){
        putchar(c[l]);
    }
    return ;
}
int n;
int a[100005];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    n=read();
    for(int i=0;i<n;i++){
        a[i]=read();
    }
    sort(a,a+n);
    int ans=n;
    int sum=n;
    int p;
    int x=0;
    int i=0;
    while(i<n){
        p=i;
        while(a[i]==a[i+1]){
            i++;
        }
        if((i-p+1)>=x){
            sum-=((i-p+1)-x);
        }
        if(sum-(i+1)>=0){
            x=i-p+1;
            ans-=(i-p+1);
            sum-=(i-p+1);
        }
        else{
            ans-=sum;
            x=0;
            break;
        }
        i++;
        cout<<"sum:"<<sum<<"  "<<"ans:"<<ans<<"  "<<"i:"<<i<<"   "<<"x:"<<x<<endl;
    }
    cout<<ans<<endl;
    return 0;
}
